//
//  BaseAlertView.m
//  IpadTestB
//
//  Created by edianzu on 2017/6/30.
//  Copyright © 2017年 ruilai. All rights reserved.
//

#import "BaseAlertView.h"

@implementation BaseAlertView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
-(instancetype)initWithFrame:(CGRect)frame{
    if ([super initWithFrame:frame]) {
        [self creatUI];
    }
    return self;
}

-(void) creatUI{
    self.backgroundColor = [UIColor whiteColor];
    //上方绿色VIEW
    self.greenView = [[UIView alloc]init];
    self.greenView.backgroundColor = UIColorFromRGB(26, 167, 157);
    [self addSubview:self.greenView];
    [self.greenView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.right.mas_equalTo(self);
        make.height.mas_equalTo(40*AutoScaleVertical);
    }];
    //提示
    self.remindLabel = [[UILabel alloc]init];
    self.remindLabel.text = @"提示";
    self.remindLabel.textColor = [UIColor whiteColor];
    [self.remindLabel setTextAlignment:NSTextAlignmentCenter];
    self.remindLabel.font = [UIFont boldSystemFontOfSize:20*AutoScaleHorizontal];
    [self.greenView addSubview:self.remindLabel];
    [self.remindLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.greenView.mas_centerX);
        make.centerY.mas_equalTo(self.greenView.mas_centerY);
        make.size.mas_equalTo(CGSizeMake(200*AutoScaleHorizontal, 20*AutoScaleVertical));
    }];
    //取消按钮
//    self.cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
//    [self.cancelBtn setImage:[UIImage imageNamed:@"cancelBtn"] forState:UIControlStateNormal];
//    [self.greenView addSubview:self.cancelBtn];
//    [self.cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.centerY.mas_equalTo(self.remindLabel.mas_centerY);
//        make.right.mas_equalTo(self.greenView.mas_right).with.offset(-20*AutoScaleHorizontal);
//        make.size.mas_equalTo(CGSizeMake(20*AutoScaleHorizontal, 20*AutoScaleVertical));
//    }];
    
    self.infomationLabel = [[UILabel alloc]init];
    self.infomationLabel.numberOfLines = 0;
    self.infomationLabel.font = [UIFont systemFontOfSize:20*AutoScaleHorizontal];
    self.infomationLabel.textColor = [UIColor blackColor];
    [self.infomationLabel setTextAlignment:NSTextAlignmentCenter];
    [self addSubview:self.infomationLabel];
    [self.infomationLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.mas_centerX);
        make.centerY.mas_equalTo(self.mas_centerY);
        make.size.mas_equalTo(CGSizeMake(400*AutoScaleHorizontal, 25*AutoScaleVertical));
    }];
    
    self.noBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    self.noBtn.backgroundColor = UIColorFromRGB(26, 167, 157);
    self.noBtn.layer.cornerRadius = 10;
    self.noBtn.layer.masksToBounds = YES;
    [self.noBtn setTitle:@"取消" forState:UIControlStateNormal];
    [self.noBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self addSubview:self.noBtn];
    [self.noBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.mas_left).with.offset(130*AutoScaleHorizontal);
        make.bottom.mas_equalTo(self.mas_bottom).with.offset(-40*AutoScaleVertical);
        make.size.mas_equalTo(CGSizeMake(80*AutoScaleHorizontal, 30*AutoScaleVertical));
    }];
    
    
    self.yesBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    self.yesBtn.backgroundColor = UIColorFromRGB(26, 167, 157);
    self.yesBtn.layer.cornerRadius = 10;
    self.yesBtn.layer.masksToBounds = YES;
    [self.yesBtn setTitle:@"确定" forState:UIControlStateNormal];
    [self.yesBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self addSubview:self.yesBtn];
    [self.yesBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(self.mas_right).with.offset(-130*AutoScaleHorizontal);
        make.bottom.mas_equalTo(self.mas_bottom).with.offset(-40*AutoScaleVertical);
        make.size.mas_equalTo(CGSizeMake(80*AutoScaleHorizontal, 30*AutoScaleVertical));
    }];
    

    
    
}
@end
